<extend name="Index/index"/>

<block name="content">
    <!--<div class="view-product" style="margin-top: 50px">-->
    <div class="info-center">
        <div class="manage-head">
            <h6 class="padding-left manage-head-con">{{$title}}</h6>
        </div>
        <div class="offcial-table input-table table-margin clearfix">
            <div class="demoTable">
                <form action="{{:U('Application/index')}}" method="get">
                    作者：
                    <div class="layui-inline">
                        <input class="layui-input" name="name"  autocomplete="off">
                    </div>
                    &nbsp;时间：
                    <div class="layui-inline">
                        <input class="layui-input" style="width: 200px" name="time" id="test1"  autocomplete="off">
                    </div>
                    &nbsp;状态：
                    <div class="layui-inline">
                        <div class="layui-input-inline">
                            <select name="status" lay-search="" class="form-control">
                                <option value="">所有</option>
                                <option value="2">待审核</option>
                                <option value="1">已审批</option>
                            </select>
                        </div>
                    </div>
                    &nbsp;排序：
                    <div class="layui-inline">
                        <div class="layui-input-inline">
                            <select name="order" lay-search="" class="form-control">
                                <option value="a.id" selected>ID</option>
                                <option value="a.applica_time">申请时间</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <div class="layui-input-inline">
                            <select name="order1" lay-search="" class="form-control">
                                <option value="asc" selected>正序</option>
                                <option value="desc">倒序</option>
                            </select>
                        </div>
                    </div>

                    <input type="submit" value="搜索" class="layui-btn">
                </form>
            </div>
            <if condition="$appList eq null">
                <div class="tr non-info show border-bottom-none">
                    <span>没查询到符合条件的记录</span>
                </div>
                <else />
                <table class="layui-table text-center">
                    <colgroup>
                        <col width="5%">
                        <col width="10%">
                        <col width="35%">
                        <col width="10%">
                        <col width="10%">
                        <col width="10%">
                        <col width="10%">
                        <col width="10%">
                    </colgroup>
                    <tr>
                        <th class="text-center">ID</th>
                        <th class="text-center">申请人</th>
                        <th class="text-center">转至支部</th>
                        <th class="text-center">申请时间</th>
                        <th class="text-center">申请状态</th>
                        <th class="text-center">审批人</th>
                        <th class="text-center">审批时间</th>
                        <th class="text-center">党费缴纳至</th>
                    </tr>
                    <foreach  name="appList" item="vo" key="k">
                        <tr onclick="showDetail(this)">
                            <td>{{$vo.id}}</td>
                            <td>{{$vo.name}}</td>
                            <td>{{$vo.department}}</td>
                            <td>{{:substr($vo['applica_time'],0,10)}}</td>
                            <td>{{$vo['applica_status']==0 ? "待审核" : "已审批"}}</td>
                            <td>{{$vo.approve_name}}</td>
                            <td>
                                <eq name="vo.approve_time" value="0000-00-00 00:00:00">
                                    <else/>{{:substr($vo['approve_time'],0,10)}}
                                </eq>
                                </td>
                            <td>{{:substr($vo['fee_time'],0,7)}}</td>
                        </tr>
                    </foreach>
                    <tr>
                        <td colspan="8"><div class="sabrosus">{{$page}}</div></td>
                    </tr>
                </table>

            </if>

        </div>
    </div>
    <!--</div>-->
    <script>
        layui.use('laydate', function() {
            var laydate = layui.laydate;
            //年选择器
            laydate.render({
                elem: '#test1'
                ,range: true
            });
        });
        function showDetail(obj){
            var id = $(obj).find("td").eq(0).text();
            $.ajax({
                type : "get",
                data : {id:id},
                dataType : "json",
                url : "{{:U('Application/queryInfoById')}}",
                success : function(msg){

                    if(msg['approve_time'] == "0000-00-00 00:00:00"){
                        msg['approve_time'] = "";
                    }
                    // console.log(msg['approve_name']);
                    if(msg['approve_name'] === null){
                        msg['approve_name'] = ""
                    }
                    if(msg['applica_status'] == 0){
                        msg['applica_status'] = "未审核"
                    }else{
                        msg['applica_status'] = "已审批"
                    }
                    layui.use("layer",function(){
                        var layer = layui.layer;
                        //示范一个公告层
                        layer.open({
                            type: 1
                            ,title: false //不显示标题栏
                            ,closeBtn: false
                            ,shade : 0
                            ,area: '500px;'

                            ,id: 'LAY_layuipro' //设定一个id，防止重复弹出
                            ,btn: ['确定']
                            ,btnAlign: 'c'
                            ,moveType: 1 //拖拽模式，0或者1
                            ,content: '<div style="padding: 30px; line-height: 30px; background-color: #393D49; color: #fff; font-weight: 300;font-size: 20px">' +
                            '姓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名:&nbsp;&nbsp;&nbsp;'+msg['name']+
                            '<br>电&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;话:&nbsp;&nbsp;&nbsp;'+msg['tel']+
                            '<br>身份证号:&nbsp;&nbsp;&nbsp;'+msg['card_num']+
                            '<br>转出支部:&nbsp;&nbsp;&nbsp;'+msg['out_department']+
                            '<br>转入支部:&nbsp;&nbsp;&nbsp;'+msg['department']+
                            '<br>申请时间:&nbsp;&nbsp;&nbsp;'+msg['applica_time'].substring(0,10)+
                            '<br>审批状态:&nbsp;&nbsp;&nbsp;'+msg['applica_status']+
                            '<br>审&nbsp;批&nbsp;&nbsp;人:&nbsp;&nbsp;&nbsp;'+msg['approve_name']+
                            '<br>审批时间:&nbsp;&nbsp;&nbsp;'+msg['approve_time']+
                            '<br>入党时间:&nbsp;&nbsp;&nbsp;'+msg['join_time'].substring(0,10)+
                            '<br>党费缴至:&nbsp;&nbsp;&nbsp;'+msg['fee_time'].substring(0,7)+
                            '</div>'

                        });
                    })
                }

            })
        }
    </script>
</block>